Function Get-ProfilePath
{
    [CmdletBinding()]
    Param()
    
    Process
    {
        If ((-Not [String]::IsNullOrEmpty($Profile)) -And (Test-Path -IsValid $Profile))
        {
            $private:ProfilePath = [System.IO.Path]::GetDirectoryName($Profile)
        }
        Else
        {
            $private:MyDocumentsPath = [System.Environment]::GetFolderPath([System.Environment+SpecialFolder]::MyDocuments)
            $private:ProfilePath = Join-Path $MyDocumentsPath "WindowsPowerShell"
        }
        
        If (-Not (Test-Path $ProfilePath))
        {
            New-Item -ItemType Directory $ProfilePath | Out-Null
        }
        
        Return $ProfilePath
    }
}

Export-ModuleMember Get-ProfilePath
